<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
  $(function() {
    $('#iconCls')
        .combobox(
            {
              data : $.iconData,
              formatter : function(v) {
                return $
                    .formatString(
                        '<span class="{0}" style="display:inline-block;vertical-align:middle;width:16px;height:16px;"></span>{1}',
                        v.value, v.value);
              },
              value : '${module.moduleIcon}'
            });

    $('#parentModuleId').combotree({
      url : '${pageContext.request.contextPath}/admin/module/tree',
      parentField : 'pid',
      lines : true,
      panelHeight : '400',
      panelWidth : '250',
      value : '${module.parentModuleId}',
      onLoadSuccess : function() {
        parent.$.messager.progress('close');
      }
    });

    $('#form').form({
      url : '${pageContext.request.contextPath}/admin/module/edit',
      onSubmit : function() {
        parent.$.messager.progress({
          title : '提示',
          text : '数据处理中，请稍后....'
        });
        var isValid = $(this).form('validate');
        if (!isValid) {
          parent.$.messager.progress('close');
        }
        return isValid;
      },
      success : function(result) {
        parent.$.messager.progress('close');
        result = $.parseJSON(result);
        if (result.success) {
          parent.$.messager.alert('提示', '修改权限成功，刷新界面或者重新登录后生效！', 'info');
          parent.$.modalDialog.openner_treeGrid.treegrid('reload');
          parent.$.modalDialog.handler.dialog('close');

        }
      }
    });
  });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
  <div data-options="region:'center',border:false" title="" style="overflow: hidden;">
    <form id="form" method="post">
      <table class="table table-hover table-condensed">
        <tr>
          <th>资源名称</th>
          <td colspan="3"><input name="id" type="hidden" value="${module.id}" /> <input
            name="moduleTypeId" type="hidden" value="0" /><input name="moduleName" type="text"
            placeholder="请输入资源名称" class="easyui-validatebox" data-options="required:true"
            style="width: 375px;" value="${module.moduleName}"></td>
        </tr>
        <tr>
          <th>资源路径</th>
          <td colspan="3"><input name="moduleUrl" type="text" placeholder="请输入资源路径"
            class="easyui-validatebox" style="width: 375px;" value="${module.moduleUrl}"></td>
        </tr>
        <tr>
          <th>排序</th>
          <td><input name="moduleSort" value="${module.moduleSort}"
            class="easyui-numberspinner" style="width: 140px; height: 29px;" required="required"
            data-options="editable:false"></td>
          <th>上级资源</th>
          <td><select id="parentModuleId" name="parentModuleId"
            style="width: 140px; height: 29px;"></select><img
            src="${pageContext.request.contextPath}/resources/css/images/extjs_icons/cut_red.png"
            onclick="$('#parentModuleId').combotree('clear');" /></td>
        </tr>
        <tr>
          <th>菜单图标</th>
          <td colspan="3"><input id="iconCls" name="moduleIcon"
            style="width: 375px; height: 29px;" data-options="editable:false" /></td>
        </tr>
        <tr>
          <th>描述</th>
          <td colspan="3"><textarea name="moduleDesc" style="width:375px;height:60px;">${module.moduleDesc}</textarea></td>
        </tr>
      </table>
    </form>
  </div>
</div>
